<h1>Livsmedelsdatabas</h1>
<?php

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('livsmedel-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>


<div class="wideform">

<?php $form=$this->beginWidget('CActiveForm', array(
	'action'=>Yii::app()->createUrl($this->route),
	'method'=>'get',
)); ?>

	<div class="row">
	<?php echo $form->textField($model,'livsmedelsnamn',array('size'=>60,'maxlength'=>100)); ?>
	<?php echo CHtml::submitButton('Search'); ?>
	</div>

	<?php $this->endWidget(); ?>

</div>
<!-- search-form -->

<p>Värdet specificeras på per 100(g)</p>

	<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'livsmedel-grid',
	'dataProvider'=>$model->search(),
	'columns'=>array(
		'livsmedelsnamn',
		'kj',
		'kcal',
		'protein',
		'fett',
		'kolhydrater',
		'fibrer',
	/*
		'salt',
		'aska',
		'vatten',
		'alkohol',
		'monosackarider',
		'disackarider',
		'sackaros',
		'fullkorn_totalt',
		'summa_mattade_fettsyror',
		'summa_enkelomattade_fettsyror',
		'summa_fleromattade_fettsyror',
		'fettsyra',
		'ePA',
		'dPA',
		'dHA',
		'summa_transfettsyror',
		'kolesterol',
		'retinolekvivalenter',
		'retinol',
		'vitamin_D',
		'vitamin_E',
		'vitamin_K',
		'tiamin',
		'riboflavin',
		'vitamin_C',
		'niacin',
		'niacinekvivalenter',
		'vitamin_B6',
		'vitamin_B12',
		'fosfor',
		'folat',
		'jod',
		'jarn',
		'kalcium',
		'kalium',
		'magnesium',
		'natrium',
		'selen',
		'zink',
		*/
array(
			'class'=>'CButtonColumn',
    		'template'=>'{view}',
),
),
)); ?>
